using System;
namespace NyMPH.Patches
{
    /// <summary>
    /// Sound Description Keywords can be classified into four categories. This is a design limit.
    /// </summary>
    public enum SDKCategories
    {
        /// <summary>
        /// Does not match any known category or is unknown.
        /// </summary>
        Unknown = 0,

        /// <summary>
        /// Sound Source
        /// </summary>
        SoundSource = 1,

        /// <summary>
        /// Instrument Type
        /// </summary>
        InstrumentType = 2,

        /// <summary>
        /// Timbre or Characteristic
        /// </summary>
        Timbre_Characteristic = 3,

        /// <summary>
        /// Articulation
        /// </summary>
        Articulation = 4,
    }
    


    /// <summary>
    /// Extension methods for the NyMPH system.
    /// </summary>
    public static class NyMPHExtensions
    {
        ///// <summary>
        ///// Sets this instance by parsing a string value into a Sound Description Keyword Category (SDKCategories enumeration type). No exceptions will be thrown.
        ///// </summary>
        ///// <param name="SDKEnum">An instance of SDKCategories providing the extension</param>
        ///// <param name="SDKString">The string to parse into a SDKCategories value.</param>
        ///// <remarks>This will (should) set an existing instance of SDKCategories to a new value. If the string is not valid, it will become Unknown</remarks>
        ///// TODO: This doesn't change the SDKEnum reference...?
        //public static SDKCategories TrySettingTo(this SDKCategories SDKEnum, string SDKString)
        //{
        //    //make sure string isn't null
        //    if (!String.IsNullOrEmpty(SDKString))
        //    {
        //        try
        //        {
        //            //parse string into SDKCategory and ignore case
        //            //SDKEnum =  (SDKCategories)Enum.Parse(typeof(SDKCategories), SDKString, true);  

        //            //kludge until database storage of this concept is resolved
        //            switch (SDKString.ToLowerInvariant())
        //            {
        //                case "source":
        //                case "soundsource":
        //                case "1":
        //                    SDKEnum = SDKCategories.SoundSource;
        //                    break;

        //                case "instrument":
        //                case "instrumenttype":
        //                case "2":
        //                    SDKEnum = SDKCategories.InstrumentType;
        //                    break;

        //                case "timbre":
        //                case "timbre_characteristic":
        //                case "3":
        //                    SDKEnum = SDKCategories.Timbre_Characteristic;
        //                    break;

        //                case "articulation":
        //                case "4":
        //                    SDKEnum = SDKCategories.Articulation;
        //                    break;

        //                 default:
        //                    SDKEnum = SDKCategories.Unknown;
        //                    break;
        //            }


        //        }
        //        catch (Exception)
        //        {
        //            SDKEnum = SDKCategories.Unknown;
        //        }

        //        return SDKEnum;
        //    }



        //}




    }
}